/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package main;

/**
 *
 * @author dalexandre
 */
public class Util {

    public static double calculateEuclidianDistance(DataVector trainningData, Centroid centroid) {

        double sum = 0.0;

        for (int i = 0; i < trainningData.getPosition().length; i++) {
            sum += Math.pow((trainningData.getPosition()[i] - centroid.getPosition()[i]), 2);
        }

        return Math.sqrt(sum);

    }
    public static double calculateEuclidianDistance(Centroid trainningData, Centroid centroid) {

        double sum = 0.0;

        for (int i = 0; i < trainningData.getPosition().length; i++) {
            sum += Math.pow((trainningData.getPosition()[i] - centroid.getPosition()[i]), 2);
        }

        return Math.sqrt(sum);

    }
}
